package com.cat.dataStructure02;

import java.util.Arrays;

/**
 * @author 曲大人的喵
 * @description https://leetcode.cn/problems/last-moment-before-all-ants-fall-out-of-a-plank/
 * @create 2025/10/20 11:39
 * @since JDK17
 */

public class Solution26 {
    public int getLastMoment(int n, int[] left, int[] right) {
        int ans = Arrays.stream(left).max().orElse(0);
        ans = Math.max(ans, Arrays.stream(right).map(i -> n - i).max().orElse(0));
        return ans;
    }
}
